<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\Exportable;


class PublishExport implements WithMultipleSheets
{

    use Exportable;

    private $pid,$cid;

    public function __construct(int $pid,int $cid)        // 导入外部查询参数
    {
        $this->pid = $pid;
        $this->cid = $cid;
    }


    public function sheets(): array
    {
        $sheets = [];

        $students = \App\Models\Lst\Student::with('term','info')
                ->wherePublish($this->pid)->whereClase($this->cid)->get();

        $sheets[] = new \App\Exports\PublishSheet($students);

        return $sheets;
    }

}
